package view;

import java.awt.Color;

//The Sub-class for objects that have x,y,size, and a contains method
public class V_DisplayObject extends V_DisplayFeature
{
  protected float xSize, xLoc, ySize, yLoc;
  protected int bgColor;

  public void init(float x, float y, float w, float h)
  {
	  xLoc = x;
	  yLoc = y; 
	  xSize = w;
	  ySize = h;
  }
  public void init(float x, float y, float w, float h, Color c)
  {
	  xLoc = x;
	  yLoc = y; 
	  xSize = w;
	  ySize = h;
	  bgColor = c.getRGB();
  }
  public void setLocation(float x, float y)
  {
    xLoc = x;
    yLoc = y; 
  }
  public void setSize(float w, float h)
  {
	xSize = w;
	ySize = h;
  }
  public float getXLoc()
  {
    return xLoc;
  }
  public void setYLoc(float val)
  {
   yLoc = val;
  }
  public void setXLoc(float val)
  {
    xLoc = val;
  }
  public float getYLoc()
  {
    return yLoc;
  }
  public float getXSize()
  {
    return xSize;
  }
  public void setXSize(float val)
  {
    xSize = val;
  }
  public float getYSize()
  {
    return ySize;
  }
  public void setYSize(float val)
  {
    ySize = val;
  }
  
  public void setBGColor(int val)
  {
    bgColor = val;
  }
  
  public void setBGColor(Color value)
  {
	  bgColor = value.getRGB();
  }
  
  @Override
  public boolean contains(float xVal, float yVal)
  {
    if (xVal < xLoc + xSize && xVal > xLoc
      && yVal < yLoc + ySize && yVal > yLoc)
    {
      return true;
    }
    else
    {
      return false;
    }
  }
}
